package utils

import (
	"crypto/md5"
	"encoding/hex"
	"strings"
)

func Md5(data string) string {
	md5_ := md5.New()
	md5_.Write([]byte(data))
	return hex.EncodeToString(md5_.Sum(nil))
}

func MD5(data string) string {
	return strings.ToUpper(Md5(data))
}

func MakePassword(pass, slat string) string {
	return Md5(pass + slat)
}

func ValidPassword(pass, slat, password string) bool {
	return MakePassword(pass, slat) == password
}
